#include "pch.h"
#include <stdlib.h>
#include "TddClient.h"

using namespace std;

TEST(TddClientDemo, Init_ok) {
  //EXPECT_EQ(1, 1);
  //EXPECT_TRUE(true);
	TddClient *client = new TddClient();
	int ret = client->init("1.1.1.1", 1000, 5);
	EXPECT_EQ(ret, 0);
	delete client;
}

TEST(TddClientDemo, Init_double_init) {
	//EXPECT_EQ(1, 1);
	//EXPECT_TRUE(true);
	TddClient *client = new TddClient();
	int ret = client->init("1.1.1.1", 1000, 5);
	EXPECT_EQ(ret, 0);
	ret = client->init("2.1.1.1", 1000, 5);
	EXPECT_EQ(ret, -1);
	delete client;
}

TEST(TddClientDemo, Init_invalid_param) {
	//EXPECT_EQ(1, 1);
	//EXPECT_TRUE(true);
	TddClient *client = new TddClient();
	int ret = client->init("", 1000, 5);

	EXPECT_EQ(ret, -1);
	delete client;
}

int main(int argc, char **argv)
{
	testing::InitGoogleTest(&argc, argv);
	return RUN_ALL_TESTS();
	system("pause");

}